<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Animal() {}

        Animal.prototype = {
            constructor:Animal,
            eat:function() {
                console.log("动物在吃") ; 
            }
        }


        function Cat() {}

        Cat.prototype = new Animal() ;

        // 覆盖原型对象中的eat方法
        Cat.prototype.eat = function() {
            // 调用父类中的eat方法
            // Animal.prototype.eat.call(this) ;
            console.log("小花猫在吃") ;
        }

        // 实例化对象
        var c = new Cat();
        c.eat() ;

        console.log(c);
        
        
        
        


    </script>
</body>
</html>